package team.sun.sss.dao.log;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface LogCourseDao {
    @Select("select * from log_course order by log_course_date desc")
    List<Map<String,Object>> getLogCourseList();

    @Select("select * from log_course where  log_sta=#{log_sta} order by log_course_date desc")
    List<Map<String,Object>> getLogStaCourseList(@Param("log_sta") String log_sta);

    @Select("select * from log_course where  log_sta=#{log_sta} and log_course_sta=#{log_course_sta} order by log_course_date desc")
    List<Map<String,Object>> getLogStaList(String log_sta,String log_course_sta);

    @Update("update log_course set log_course_name = #{log_course_name},log_course_sta = #{log_course_sta},log_course_major = #{log_course_major},log_course_class = #{log_course_class},log_place = #{log_place},log_listen_date = #{log_listen_date},log_course_content = #{log_course_content},log_describe = #{log_describe} where log_course_id = #{log_course_id}")
    int updateCourse(String log_course_name, String log_course_sta, String log_course_major, String log_course_class, String log_place, String log_listen_date, String log_describe, String log_course_content, int log_course_id);


    @Delete("delete from log_course where log_course_id = #{log_course_id}")
    int deleteLogCourse(@Param("log_course_id") int id);

    @Insert("insert into log_course(log_course_name,log_course_sta,log_course_major,log_course_class,log_place,log_course_date,log_listen_date,log_course_content,log_describe,log_sta) " +
            "values(#{log_course_name},#{log_course_sta},#{log_course_major},#{log_course_class},#{log_place},#{log_course_date},#{log_listen_date},#{log_course_content},#{log_describe},#{log_sta})")
    int addLogCourse(String log_course_name, String log_course_sta, String log_course_major, String log_course_class, String log_place, String log_course_date, String log_listen_date, String log_course_content, String log_describe, String log_sta);
}
